#include <Windows.h>
#include "myLog.h"
#include "Utility.h"
static LogConfig DefConfig;

inline const char* GetModuleName()
{
	return "TSMCDLL";
}

void LogInfo(int logType, const char* pszFormat, ...)
{
	char szBuffer[8192];
	{
		va_list ap;
		va_start(ap, pszFormat);
		_vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ap);
		va_end(ap);
		int len = strlen(szBuffer)-1;
		if(szBuffer[len]=='\n'||szBuffer[len]=='\r')
			szBuffer[len] = '\0';
	}

	SimpleLogInfo(&DefConfig, logType, szBuffer);
}
void MyLogInfo(const char* pszClassFunc, int logType, const char* pszFormat, ...)
{
	char szBuffer[8192];
	{
		va_list ap;
		va_start(ap, pszFormat);
		_vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ap);
		va_end(ap);
		int len = strlen(szBuffer)-1;
		if(szBuffer[len]=='\n'||szBuffer[len]=='\r')
			szBuffer[len] = '\0';
	}

	DoLogInfo(&DefConfig, pszClassFunc, logType, szBuffer);
}



BOOL MyLogConfig(const char *szFilePath, int nLogLevl, int nLogViewLevl, BOOL bOutput, BOOL bOutputDebugView, BOOL bOutputFile, int LogHisLim)
{
	strcpy(DefConfig.szModuleName, GetModuleName());
	return MakeLogConfig(&DefConfig, szFilePath, nLogLevl, nLogViewLevl, bOutput, bOutputDebugView, bOutputFile, LogHisLim);
}
